/*
Copyright (C) 1996 Hughes and Applied Research Corporation

Permission to use, modify, and distribute this software and its documentation 
for any purpose without fee is hereby granted, provided that the above 
copyright notice appear in all copies and that both that copyright notice and 
this permission notice appear in supporting documentation.
*/

#ifndef HDFEOSDEF_H_
#define HDFEOSDEF_H_

/* include header file for EASE grid */
#include <ease.h>

/* Working Buffer Sizes */
#define HDFE_MAXMEMBUF  256*256*16
#define HDFE_NAMBUFSIZE 32000
#define HDFE_DIMBUFSIZE 64000


/* Field Merge */
#define HDFE_NOMERGE   0
#define HDFE_AUTOMERGE 1


/* XXentries Modes */
#define HDFE_NENTDIM   0
#define HDFE_NENTMAP   1
#define HDFE_NENTIMAP  2
#define HDFE_NENTGFLD  3
#define HDFE_NENTDFLD  4


/* GCTP projection codes */
#define GCTP_GEO       0
#define GCTP_UTM       1
#define GCTP_SPCS      2
#define GCTP_ALBERS    3
#define GCTP_LAMCC     4
#define GCTP_MERCAT    5
#define GCTP_PS        6
#define GCTP_POLYC     7
#define GCTP_EQUIDC    8
#define GCTP_TM        9
#define	GCTP_STEREO   10
#define GCTP_LAMAZ    11
#define	GCTP_AZMEQD   12
#define GCTP_GNOMON   13
#define	GCTP_ORTHO    14
#define GCTP_GVNSP    15
#define	GCTP_SNSOID   16
#define GCTP_EQRECT   17
#define	GCTP_MILLER   18
#define GCTP_VGRINT   19
#define	GCTP_HOM      20
#define GCTP_ROBIN    21
#define	GCTP_SOM      22
#define GCTP_ALASKA   23
#define	GCTP_GOOD     24
#define GCTP_MOLL     25
#define	GCTP_IMOLL    26
#define GCTP_HAMMER   27
#define	GCTP_WAGIV    28
#define GCTP_WAGVII   29
#define	GCTP_OBLEQA   30
#define	GCTP_ISINUS1  31
#define	GCTP_CEA      97
#define	GCTP_BCEA     98
#define	GCTP_ISINUS   99


/* Compression Modes */
#define HDFE_COMP_NONE     0
#define HDFE_COMP_RLE      1    
#define HDFE_COMP_NBIT     2
#define HDFE_COMP_SKPHUFF  3    
#define HDFE_COMP_DEFLATE  4
#define HDFE_COMP_SZIP     5


/* Tiling Codes */
#define HDFE_NOTILE        0
#define HDFE_TILE          1


/* Swath Subset Modes */
#define HDFE_MIDPOINT       0
#define HDFE_ENDPOINT       1
#define HDFE_ANYPOINT       2
#define HDFE_INTERNAL       0
#define HDFE_EXTERNAL       1
#define HDFE_NOPREVSUB     -1



/* Grid Origin */
#define HDFE_GD_UL         0
#define HDFE_GD_UR         1
#define HDFE_GD_LL         2
#define HDFE_GD_LR         3



/* Grid Pixel Registration */
#define HDFE_CENTER        0
#define HDFE_CORNER        1


/* Angle Conversion Codes */
#define HDFE_RAD_DEG      0
#define HDFE_DEG_RAD      1
#define HDFE_DMS_DEG      2
#define HDFE_DEG_DMS      3
#define HDFE_RAD_DMS      4
#define HDFE_DMS_RAD      5

/* SZIP parameters */
#define SZ_EC             4
#define SZ_NN            32

#ifdef HDFEOS_STATIC
  #define EXTERN extern
#else
#   if defined (_WIN32) || defined (WINDOWS)
#    ifdef HDFEOS_DLL_EXPORTS
#      ifdef __GNUC__
#        define EXTERN extern __attribute__((dllexport))
#      else        
#        define EXTERN extern __declspec(dllexport)
#      endif 
#    else
#      ifdef __GNUC__
#        define EXTERN extern __attribute__((dllimport))
#      else        
#        define EXTERN extern __declspec(dllimport)
#      endif 
#    endif
#   else
#     if __GNUC__ >= 4
#       define EXTERN __attribute__((visibility("default")))
#     else
#       define EXTERN                extern
#     endif 
#   endif
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* Swath Prototype */
EXTERN int32 SWopen(char *, intn);
EXTERN int32 SWcreate(int32, char *);
EXTERN int32 SWattach(int32, char *);
EXTERN intn SWdefdim(int32, char *, int32);
EXTERN intn SWdefcomp(int32, int32, intn []);
EXTERN int32 SWdiminfo(int32, char *);
EXTERN intn SWmapinfo(int32, char *, char *, int32 *, int32 *);
EXTERN int32 SWidxmapinfo(int32, char *, char *, int32 []);
EXTERN intn SWfieldinfo(int32, char *, int32 *, int32 [], int32 *, char *);
EXTERN intn SWcompinfo(int32, char *, int32 *, intn []);
EXTERN intn SWdefdimmap(int32, char *, char *, int32, int32);
EXTERN intn SWdefidxmap(int32, char *, char *, int32 []);
EXTERN intn SWdefgeofield(int32, char *, char *, int32, int32);
EXTERN intn SWdefdatafield(int32, char *, char *, int32, int32);
EXTERN intn SWwritegeometa(int32, char *, char *, int32);
EXTERN intn SWwritedatameta(int32, char *, char *, int32);
EXTERN intn SWwriteattr(int32, char *, int32, int32, VOIDP);
EXTERN intn SWreadattr(int32, char *, VOIDP);
EXTERN intn SWattrinfo(int32, char *, int32 *, int32 *);
EXTERN int32 SWinqdims(int32, char *, int32 []);
EXTERN int32 SWinqmaps(int32, char *, int32 [], int32 []);
EXTERN int32 SWinqidxmaps(int32, char *, int32 []);
EXTERN int32 SWinqgeofields(int32, char *, int32 [], int32 []);
EXTERN int32 SWinqdatafields(int32, char *, int32 [],int32 []);
EXTERN int32 SWinqattrs(int32, char *, int32 *);
EXTERN int32 SWnentries(int32, int32, int32 *);
EXTERN int32 SWinqswath(char *, char *, int32 *);
EXTERN intn SWwritefield(int32, char *, int32 [], int32 [], int32 [], VOIDP);
EXTERN intn SWreadfield(int32, char *, int32 [], int32 [], int32 [], VOIDP);
EXTERN int32 SWdefboxregion(int32, float64 [], float64 [], int32);
EXTERN int32 SWdefscanregion(int32, char *, float64 [], int32);
EXTERN int32 SWregionindex(int32, float64 [], float64 [], int32, char *, int32 []);
EXTERN intn SWextractregion(int32, int32, char *, int32, VOIDP);
EXTERN intn SWregioninfo(int32, int32, char *, int32 *, int32 *, int32 [], int32 *);
EXTERN int32 SWdupregion(int32);
EXTERN int32 SWdeftimeperiod(int32, float64, float64, int32);
EXTERN intn SWextractperiod(int32, int32, char *, int32, VOIDP);
EXTERN intn SWperiodinfo(int32, int32, char *, int32 *, int32 *, int32 [], int32 *);
EXTERN int32 SWdefvrtregion(int32, int32, char *, float64 []);
EXTERN intn SWsetfillvalue(int32, char *, VOIDP);
EXTERN intn SWgetfillvalue(int32, char *, VOIDP);
EXTERN intn SWdetach(int32);
EXTERN intn SWclose(int32);
EXTERN int32 SWupdateidxmap(int32, int32, int32 [], int32 [], int32 []);
EXTERN intn SWgeomapinfo(int32, char *);
EXTERN intn SWupdatescene(int32, int32);
EXTERN int32 SWindexinfo(int32, char *, int32 *, char *, int32 *ind[]);
EXTERN intn SWdefdimscale(int32 swathID, char *dimname, int32 dimsize, int32 numbertype, VOIDP data);
EXTERN intn SWsetdimscale(int32, char *, char *, int32, int32, VOIDP);
EXTERN intn SWgetdimscale(int32, char *, char *, int32 *, int32 *, VOIDP);
EXTERN intn SWsetdimstrs(int32 swathID, char *fieldname, char *dimname, char *label, char *unit, char *format);
EXTERN intn SWgetdimstrs(int32 swathID, char *fieldname, char *dimname, char *label, char *unit, char *format, intn len);

/* Grid Prototypes */
EXTERN int32 GDopen(char *, intn);
EXTERN int32 GDcreate(int32, char *, int32, int32, float64 [], float64 []);
EXTERN int32 GDattach(int32, char *);
EXTERN intn GDdefdim(int32, char *, int32);
EXTERN intn GDdefproj(int32, int32, int32, int32, float64 []);
EXTERN intn GDblkSOMoffset(int32, float32 [], int32, char *);
EXTERN intn GDdefcomp(int32, int32, intn []);
EXTERN intn GDdeftile(int32, int32, int32, int32 []);
EXTERN intn GDsettilecomp(int32, char *, int32, int32 *, int32, intn *);
EXTERN intn GDdeforigin(int32, int32);
EXTERN intn GDdefpixreg(int32, int32);
EXTERN int32 GDdiminfo(int32, char *);
EXTERN intn GDgridinfo(int32, int32 *, int32 *, float64 [], float64 []);
EXTERN intn GDprojinfo(int32, int32 *, int32 *, int32 *, float64 []);
EXTERN intn GDorigininfo(int32, int32 *);
EXTERN intn GDpixreginfo(int32, int32 *);
EXTERN intn GDcompinfo(int32, char *, int32 *, intn []);
EXTERN intn GDfieldinfo(int32, char *, int32 *, int32 [], int32 *, char *);
EXTERN intn GDtileinfo(int32, char *, int32 *, int32 *, int32 []);
EXTERN intn GDsettilecache(int32, char *, int32, int32);
EXTERN intn GDwritetile(int32, char *, int32 [], VOIDP);
EXTERN intn GDreadtile(int32, char *, int32 [],  VOIDP);
EXTERN intn GDdeffield(int32, char *, char *, int32, int32);
EXTERN intn GDwritefieldmeta(int32, char *, char *, int32);
EXTERN intn GDwritefield(int32, char *, int32 [], int32 [], int32 [], VOIDP);
EXTERN intn GDreadfield(int32, char *, int32 [], int32 [], int32 [], VOIDP);
EXTERN intn GDwriteattr(int32, char *, int32 , int32, VOIDP);
EXTERN intn GDreadattr(int32, char *, VOIDP);
EXTERN intn GDattrinfo(int32, char *, int32 *, int32 *);
EXTERN int32 GDinqdims(int32, char *, int32 []);
EXTERN int32 GDinqfields(int32, char *, int32 [], int32 []);
EXTERN int32 GDinqattrs(int32, char *, int32 *);
EXTERN int32 GDnentries(int32, int32, int32 *);
EXTERN int32 GDinqgrid(char *, char *, int32 *);
EXTERN int32 GDdefboxregion(int32, float64 [], float64 []);
EXTERN int32 GDdefvrtregion(int32, int32, char *, float64 []);
EXTERN int32 GDdeftimeperiod(int32, int32, float64, float64);
EXTERN intn GDextractregion(int32, int32, char *, VOIDP);
EXTERN intn GDregioninfo(int32, int32, char *, int32 *, int32 *, int32 [], int32 *, float64 [], float64 []);
EXTERN int32 GDdupregion(int32);
EXTERN intn GDgetpixels(int32, int32, float64 [], float64 [], int32 [], int32 []);
EXTERN int32 GDgetpixvalues(int32, int32, int32 [], int32 [], char *, VOIDP);
EXTERN int32 GDinterpolate(int32, int32, float64 [], float64 [], char *, float64 []);
EXTERN intn GDsetfillvalue(int32, char *, VOIDP);
EXTERN intn GDgetfillvalue(int32, char *, VOIDP);
EXTERN intn GDdetach(int32);
EXTERN intn GDclose(int32);

EXTERN intn GDij2ll(int32, int32, float64 [], int32, int32, int32, 
	     float64 [], float64 [], int32, int32 [], int32 [],
	     float64 [], float64 [], int32, int32);
EXTERN intn GDll2ij(int32, int32, float64 [], int32, int32, int32, float64 [], 
             float64 [], int32, float64 [], float64 [],	int32 [], int32 [],
	     float64 [], float64 []);
EXTERN intn GDrs2ll(int32, float64 [], int32, int32,
	     float64 [], float64 [],
	     int32, float64 [], float64 [],
	     float64 [], float64 [], int32, int32);

EXTERN intn GDdefdimscale(int32 gridID, char *dimname, int32 dimsize, int32 numbertype, VOIDP data);
EXTERN intn GDsetdimscale(int32, char *, char *, int32, int32, VOIDP);
EXTERN intn GDgetdimscale(int32, char *, char *, int32 *, int32 *, VOIDP);
EXTERN intn GDsetdimstrs(int32 gridID, char *fieldname, char *dimname, char *label, char *unit, char *format);
EXTERN intn GDgetdimstrs(int32 gridID, char *fieldname, char *dimname, char *label, char *unit, char *format, intn len);

/* Point Prototypes */
EXTERN int32 PTopen(char *, intn);
EXTERN int32 PTcreate(int32, char *);
EXTERN int32 PTnrecs(int32, int32);
EXTERN int32 PTnlevels(int32);
EXTERN int32 PTsizeof(int32, char *, int32 []);
EXTERN int32 PTnfields(int32, int32, int32 *);
EXTERN int32 PTlevelindx(int32, char *);
EXTERN int32 PTattach(int32, char *);
EXTERN intn PTdeflevel(int32, char *, char *, int32 [], int32 []);
EXTERN intn PTdeflinkage(int32, char *, char *, char *);
EXTERN intn PTbcklinkinfo(int32, int32, char *);
EXTERN intn PTfwdlinkinfo(int32, int32, char *);
EXTERN int32 PTlevelinfo(int32, int32, char *, int32 [], int32 []);
EXTERN intn PTgetlevelname(int32, int32, char *, int32 *);
EXTERN intn PTwritelevel(int32, int32, int32, VOIDP);
EXTERN intn PTupdatelevel(int32, int32, char *, int32, int32 [], VOIDP);
EXTERN intn PTreadlevel(int32, int32, char *, int32, int32 [], VOIDP);
EXTERN intn PTgetrecnums(int32, int32, int32, int32, int32 [], int32 *, int32 []);
EXTERN intn PTwriteattr(int32, char *, int32, int32, VOIDP);
EXTERN intn PTreadattr(int32, char *, VOIDP);
EXTERN intn PTattrinfo(int32, char *, int32 *, int32 *);
EXTERN int32 PTinqattrs(int32, char *, int32 *);
EXTERN int32 PTinqpoint(char *, char *, int32 *);
EXTERN int32 PTdefboxregion(int32, float64 [], float64 []);
EXTERN int32 PTdeftimeperiod(int32, float64, float64);
EXTERN int32 PTdefvrtregion(int32, int32, char *, float64 []);
EXTERN intn PTregioninfo(int32, int32 regionID, int32, char *, int32 *);
EXTERN intn PTregionrecs(int32, int32, int32, int32 *, int32 []);
EXTERN intn PTperiodrecs(int32, int32, int32, int32 *, int32 []);
EXTERN intn PTperiodinfo(int32, int32 periodID, int32, char *, int32 *);
EXTERN intn PTextractregion(int32, int32 regionID, int32, char *, VOIDP);
EXTERN intn PTextractperiod(int32, int32 periodID, int32, char *, VOIDP);
EXTERN intn PTdetach(int32);
EXTERN intn PTclose(int32);



/* EH Utility Prototypes */
EXTERN float64 EHconvAng(float64, intn);
EXTERN int32 EHparsestr(char *, char, char *[], int32 []);
EXTERN int32 EHstrwithin(char *, char *, char);
EXTERN intn EHchkODL(char *);
EXTERN intn EHloadliststr(char *[], int32, char *, char);
EXTERN intn EHgetversion(int32, char *);
EXTERN int32 EHopen(char *, intn);
EXTERN intn EHchkfid(int32, char *, int32 *, int32 *, uint8 *);
EXTERN intn EHidinfo(int32, int32 *, int32 *);
EXTERN int32 EHgetid(int32, int32, char *, intn, char *);
EXTERN intn EHrevflds(char *, char *);
EXTERN intn EHinsertmeta(int32, char *, char *, int32, char *, int32 []);
EXTERN intn EHgetmetavalue(char *[], char *, char *);
EXTERN char * EHmetagroup(int32, char *, char *, char *, char *[]);
EXTERN intn EHfillfld(int32, int32, int32, int32, int32, int32 [], VOIDP);
EXTERN intn EHattr(int32, int32, char *, int32, int32, char *, VOIDP);
EXTERN intn EHattrinfo(int32, int32, char *, int32 *, int32 *);
EXTERN int32 EHattrcat(int32, int32, char *, int32 *);
EXTERN intn EHfilename(int32, char *);
EXTERN int32 EHcntOBJECT(char *[]);
EXTERN int32 EHcntGROUP(char *[]);
/* 9/3/97 Abe changed the first argument from 
   float64 (float64 []) to float64 (*) (float64 [])  for SunOS
   float64 () (float64 []) to float64 (*) (float64 [])  for all other OSs */
EXTERN intn EHbisect(float64 (*) (float64 []), float64 [], int32, float64, float64, 
	      float64, float64 *);
EXTERN int32 EHinquire(char *, char *, char *, int32 *);
EXTERN intn EHclose(int32);



#ifdef __cplusplus
}
#endif


#endif  /* #ifndef HDFEOSDEF_H_ */










